package app.fugema.shop.main.home.model;

import com.base.common.utils.UIUtils;
import app.fugema.shop.main.invoice.model.ConsultListBean;
import com.rex.editor.common.Utils;

import java.util.List;

public class PopularListBean {

    /**
     * code : 0
     * msg : 成功
     * data : [{"id":1,"title":"小狗该怎么护理","content":"小狗该怎么护理小狗该怎么护理小狗该怎么护理小狗该怎么护理小狗该怎么护理小狗该怎么护理小狗该怎么护理","pic":"https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/c6a891b2718d404a9d973fdbfeb97452.jpg","createTime":"2021-01-22 17:09:54","creator":1},{"id":2,"title":"狗狗夜里老是叫怎么办1","content":"<p>狗狗夜里老是叫怎么办狗狗夜里老是叫怎么办狗狗夜里老是叫怎么办狗狗夜里老是叫怎么办1<\/p>","pic":"https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/c6a891b2718d404a9d973fdbfeb97452.jpg","createTime":"2021-01-23 17:09:59","creator":1}]
     */

    private int code;
    private String msg;
    private List<DataBean> data;
    private List<ConsultListBean.DataBean> list;

    public List<ConsultListBean.DataBean> getList() {
        return list;
    }

    public void setList(List<ConsultListBean.DataBean> list) {
        this.list = list;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * id : 1
         * title : 小狗该怎么护理
         * content : 小狗该怎么护理小狗该怎么护理小狗该怎么护理小狗该怎么护理小狗该怎么护理小狗该怎么护理小狗该怎么护理
         * pic : https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/c6a891b2718d404a9d973fdbfeb97452.jpg
         * createTime : 2021-01-22 17:09:54
         * creator : 1
         */

        private int id;
        private String title;
        private String content;
        private String pic;
        private String createTime;
        private int creator;

        public boolean showImage() {
           return UIUtils.isNotEmpty(pic);
        }

        public String getContent() {
            return Utils.getHtml2Text(content);
//            return content;
        }

        public String getPic() {
            if (UIUtils.isEmpty(pic)) {
                return null;
            } else if (pic.contains(",")) {
                return pic.split(",")[0];
            }
            return pic;
        }


        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }


        public void setContent(String content) {
            this.content = content;
        }


        public void setPic(String pic) {
            this.pic = pic;
        }

        public String getCreateTime() {
            return createTime;
        }

        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }

        public int getCreator() {
            return creator;
        }

        public void setCreator(int creator) {
            this.creator = creator;
        }
    }
}
